package com.ftg.learn.day16.annotationbase;

import com.ftg.learn.day16.myself.SpringIocContainer;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 布衣
 */
public class SpringView {

    public static void main(String[] args) {

        //第一种获取实例的方法
//        ApplicationContext  是不是也可以拿到我们组件
        BeanFactory beanFactory = new ClassPathXmlApplicationContext("spring/annotation.xml");

//        Fly fly = (Fly) beanFactory.getBean("fly");
//        System.out.println(fly.getName());


        //第二种获取实例的方法
        System.out.println("=============>");
        Helicopter bean = beanFactory.getBean(Helicopter.class);
        System.out.println(bean.getFly1().getName());

    }

}

